package com.team.ai.service;

import com.team.ai.entity.Book;
import com.team.ai.entity.ResultEntity;
import com.team.ai.mapper.BookMapper;
import com.team.ai.mapper.SignMapper;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class SignService {
    private static final Logger logger= LoggerFactory.getLogger(SignService.class);//日志getLogger需要传入的类名
    @Resource
    SignMapper signMapper;
    public String insert(int userId,int isQd){
        try{
            return ResultEntity.success(signMapper.insert(userId, isQd)) ;
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getLocalizedMessage());
            return  ResultEntity.fail(-10005);
        }
    }


    public String update(int isQd,int userId){
        try{
            return ResultEntity.success(signMapper.update(isQd, userId)) ;
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getLocalizedMessage());
            return  ResultEntity.fail(-10005);
        }
    }
    public String selectList(int userId){
        try{
            return ResultEntity.success(signMapper.selectList(userId)) ;
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getLocalizedMessage());
            return  ResultEntity.fail(-10005);
        }
    }
    public String selectDetail(int id,int userId){
        try{
            return ResultEntity.success(signMapper.selectDetail(id,userId)) ;
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getLocalizedMessage());
            return  ResultEntity.fail(-10005);
        }
    }

}
